<ui:composition template="/xhtml/component/template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:t="http://myfaces.apache.org/tomahawk">
	<ui:define name="page">
		<h:form prependId="false">
			<t:saveState value="#{recommenderBean}" />
			<p:outputPanel id="pnlPreferences"
				style="width: 99%; text-align: center;">
				<p:tabView>
					<p:tab title="#{msg.label_preferences}">
						<p:messages id="messages" showDetail="true" />
						<br />
						<p:outputPanel style="width: 99%; text-align: left;">
							<h:panelGrid columns="2">
								<h:outputLabel value="#{msg.label_user_email}:" />
								<h:inputText id="userEmail" maxlength="100" size="40"
									value="#{recommenderBean.userEmail}" />
							</h:panelGrid>
						</p:outputPanel>
						<br />
						<h:panelGrid columns="3" style="text-align: center; width: 99%;">
							<p:dataTable var="preference"
								value="#{recommenderBean.moviesPreferences}">
								<p:column>
									<f:facet name="header">
										<h:outputText value="#{msg.label_movie}" />
									</f:facet>
									<h:outputText value="#{preference.item.description}" />
								</p:column>
								<p:column>
									<f:facet name="header">
										<h:outputText value="#{msg.label_rate}" />
									</f:facet>
									<h:inputText value="#{preference.rate}" size="5"
										style="height: 18px;">
										<f:convertNumber type="number" minFractionDigits="2"
											maxIntegerDigits="2" pattern="0.00" />
									</h:inputText>
								</p:column>
							</p:dataTable>
							<p:dataTable var="preference"
								value="#{recommenderBean.singersPreferences}">
								<p:column>
									<f:facet name="header">
										<h:outputText value="#{msg.label_singer}" />
									</f:facet>
									<h:outputText value="#{preference.item.description}" />
								</p:column>
								<p:column>
									<f:facet name="header">
										<h:outputText value="#{msg.label_rate}" />
									</f:facet>
									<h:selectOneMenu value="#{preference.rate}">
										<f:selectItem itemLabel="#{msg.label_none}" itemValue="0" />
										<f:selectItem itemLabel="#{msg.label_like_it}" itemValue="1" />
										<f:selectItem itemLabel="#{msg.label_dont_like_it}"
											itemValue="2" />
									</h:selectOneMenu>
								</p:column>
							</p:dataTable>
							<p:dataTable var="preference"
								value="#{recommenderBean.booksPreferences}">
								<p:column>
									<f:facet name="header">
										<h:outputText value="#{msg.label_book}" />
									</f:facet>
									<h:outputText value="#{preference.item.description}" />
								</p:column>
								<p:column>
									<f:facet name="header">
										<h:outputText value="#{msg.label_rate}" />
									</f:facet>
									<h:selectOneMenu value="#{preference.rate}">
										<f:selectItem itemLabel="#{msg.label_none}" itemValue="0" />
										<f:selectItem itemLabel="#{msg.label_excellent}" itemValue="5" />
										<f:selectItem itemLabel="#{msg.label_very_good}" itemValue="4" />
										<f:selectItem itemLabel="#{msg.label_average}" itemValue="3" />
										<f:selectItem itemLabel="#{msg.label_below_average}"
											itemValue="2" />
										<f:selectItem itemLabel="#{msg.label_bad}" itemValue="1" />
									</h:selectOneMenu>
								</p:column>
							</p:dataTable>
						</h:panelGrid>

					</p:tab>
				</p:tabView>
				<br />
				<p:commandButton id="btnSave" value="#{msg.label_save}" ajax="false"
					action="#{recommenderBean.save}" />
			</p:outputPanel>

		</h:form>
	</ui:define>
</ui:composition>